package cn.ynrcb.personnelfile.admin.dao;

import cn.ynrcb.personnelfile.admin.entity.NoticeEntity;
import cn.ynrcb.personnelfile.admin.vo.NoticeListVo;
import cn.ynrcb.personnelfile.admin.vo.NoticeVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 通知表
 *
 * @author lihui
 * @email 379612472@qq.com
 * @date 2021-06-08 14:51:29
 */
@Mapper
public interface NoticeDao extends BaseMapper<NoticeEntity> {
    /**
     * 条件查询分页列表
     */
    List<NoticeListVo> queryListPage(Page<NoticeListVo> page, @Param("map") Map<String, Object> params);

    /**
     * 条件查询列表
     */
    List<NoticeEntity> queryList(@Param("map") Map<String, Object> params);

    /**
     *
     */
    @Select("SELECT n.title,n.content,n.type,s.is_read as isRead,s.user_id as userId FROM tb_notice_send s LEFT JOIN tb_notice n ON s.notice_id=n.id WHERE s.id=#{noticeSendId}")
    NoticeVo.InfoResp noticeInfo(@Param("noticeSendId") Long noticeSendId);

    List<NoticeEntity> queryAdminPage(Page<NoticeEntity> page,@Param(value = "map")  Map<String, Object> params);
}
